﻿using System.Collections.Generic;
using Dolany.UtilityTool;

namespace Missbot.AIModule.Pet.PetAgainst
{
    public partial class PetAgainstEngine
    {
        [PetGamingEffect(Name = "中毒")]
        public string 中毒Buff(Dictionary<string, object> data)
        {
            return DoDemage(AimPet, SelfPet, DemageType.毒系, (int)data["Hurt"], "中毒");
        }

        [PetGamingEffect(Name = "百分比防御")]
        public string 百分比防御Buff(Dictionary<string, object> data)
        {
            var defence = (int) data["Defence"];
            var value = (int) data["Value"];

            return defence >= 100 ? "0" : (value * (100 - defence) / 100).ToString();
        }

        [PetGamingEffect(Name = "百分比伤害")]
        public string 百分比伤害Buff(Dictionary<string, object> data)
        {
            var value = (int) data["Value"];
            var rate = (int) data["Rate"];

            return (value * (rate + 100) / 100).ToString();
        }

        [PetGamingEffect(Name = "物理攻击增加")]
        public string 物理攻击增加Buff(Dictionary<string, object> data)
        {
            var value = (int) data["Value"];
            var addPhy = (int) data["addPhy"];

            return (value + addPhy).ToString();
        }

        [PetGamingEffect(Name = "反击Buff")]
        public string 反击Buff(Dictionary<string, object> data)
        {
            var hurt = (int) data["Hurt"];
            var source = data["Source"] as GamingPet;
            var dest = data["Dest"] as GamingPet;

            var msg = DoDemage(dest, source, DemageType.魔法, hurt, "反击");
            SendMessage(msg);

            var value = (int) data["Value"];
            return value.ToString();
        }

        [PetGamingEffect(Name = "闷棍")]
        public string 闷棍Buff(Dictionary<string, object> data)
        {
            var rate = (int) data["Rate"];
            return Rander.RandInt(100) < rate ? "技能释放失败！" : string.Empty;
        }
    }
}